<include file="public@header" />
</head>
<body>
<div class="wrap js-check-wrap">
	<ul class="nav nav-tabs">
        <li><a href="{:url('goodscat/index')}">类别列表</a></li>
        <li class="active"><a href="#">编辑类别</a></li>
    </ul>
    <form class="form-horizontal js-ajax-form margin-top-20" role="form"  method="post">
        <fieldset>
            <div class="tabbable">
                <div class="tab-content">
                    <div class="tab-pane active" id="A">
                    <input type="text" style="display:none;" id="gc_guid" name="gc_guid" value="{$data.gc_guid}">
                        <div class="form-group">
                            <label for="input-name" class="col-sm-2 control-label"><span class="form-required">*</span>类别名称</label>
                            <div class="col-md-6 col-sm-10">
                                <input type="text" class="form-control" id="gc_name" name="gc_name" value="{$data.gc_name}">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <button type="button" class="btn btn-primary js-ajax-submit" data-refresh="0">{:lang('SAVE')}</button>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </fieldset>
    </form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script>
    $('.btn').click(function(){
        var gc_name=$('#gc_name').val();
        var gc_guid=$('#gc_guid').val();
        var char=/^[\u4e00-\u9fa5_a-zA-Z0-9]+$/;
        var pd=char.test(gc_name);
        if(pd == false)
        {
            alert('您好！名字不能带有符号！');
            return false;
        }
        $.post("{:url('goodscat/detailpost')}",{gc_name:gc_name,gc_guid:gc_guid},function (date) {
            if(date.msg == 1)
            {
                alert('添加成功');
                window.location="{:url('goodscat/index')}";
            }else{
                alert('添加失败');
            }
        })
    })

</script>
</body>
</html>